<%--
  - Author		:	이 영호(Youngho Lee)	
  --%>
<%@ page language="java" %>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page pageEncoding="utf-8" %>
<%@ include file="/WEB-INF/pages/includes/taglibs.jspf" %>
<%@ include file="/WEB-INF/pages/includes/variables.jspf" %>
<%@ include file="/WEB-INF/pages/includes/doctype.jspf" %>
<html>
	<head>
<%@ include file="/WEB-INF/pages/includes/metatags.jspf" %>
		<title><fmt:message key="pages.title" /></title>
		<link rel="stylesheet" type="text/css" href="<c:url value="${dirStyles}/common.css" />" />

		<script type="text/javascript" src="<c:url value="${dirScripts}/jquery-1.7.2.min.js" />"></script>
		<script type="text/javascript">
			$(function(){
			});

			function goAction(idx){
				document.detailFrm.idx.value=idx;
				document.detailFrm.submit();
			}
			
			function goPage(page){
				document.searchFrm.page.value = page;
				document.searchFrm.submit();
			}

		</script>
	</head>
	<body>
<%@ include file="/WEB-INF/pages/includes/header.jsp" %>
		<div class="bodyWrap">
<%@ include file="/WEB-INF/pages/includes/left.jsp" %>
			<div class="contWrap">
				<div class="contMenuTitle">
					<img src="<c:url value="${dirImages}/subtit_07_1.gif" />" title="회원관리" alt="회원관리">
				</div>
				<div class="secTitle">
					<img src="<c:url value="${dirImages}/icon.png" />" title="회원관리" alt="회원관리" > 회원관리
					<div style="float: right;">
						<form name="searchFrm" method="post" action="<c:url value="/backoffice/user/list.do" />">
							<input type="hidden" name="maxnum" value="${maxnum}" />
							<input type="hidden" name="page" value="${page}" />
							<select name="searchType">
								<option value="id" <c:if test="${param.searchType eq 'id'}"> selected="selected" </c:if>>ID</option>
								<option value="name" <c:if test="${param.searchType eq 'name'}"> selected="selected" </c:if>>이름</option>
								<option value="bizNm" <c:if test="${param.searchType eq 'bizNm'}"> selected="selected" </c:if>>업체명</option>
							</select>
							<input type="text" name="searchWord" value="${param.searchWord}" />
							<input type="submit" class="btn btn_search" alt="검색" title="검색" value="">
						</form>
					</div>
				</div>
				<table class="listTbl linked">
					<thead>
						<tr>
							<th>번호</th>
							<th>ID</th>
							<th>이름</th>
							<th>업체명</th>
							<th>회원상태</th>
							<th class="lastTh">회원등급</th>
						</tr>
					</thead>
					<c:forEach items="${userList}" var="user" varStatus="stat">
						<tbody>
							<tr onclick="javascript:goAction(${user.idx});">
								<td>${userListTotalCnt - stat.index - (maxnum*(page-1))}</td>
								<td><c:out value="${user.id}" /></td>
								<td><c:out value="${user.name}" /></td>
								<td><c:out value="${user.bizNm}" /></td>
								<td>
									<c:choose>
										<c:when test="${user.isDel eq 1}">탈퇴회원</c:when>
										<c:when test="${user.enabled eq 0}">가입 대기</c:when>
										<c:when test="${user.enabled eq 1}">정회원</c:when>
									</c:choose>
								</td>
								<td>
									<c:choose>
										<c:when test="${user.authority eq 'ROLE_ADMIN'}">운영자</c:when>
										<c:when test="${user.authority eq 'ROLE_USER'}">일반회원</c:when>
										<c:when test="${user.authority eq 'ROLE_TESTER'}">체험단</c:when>
									</c:choose>
								</td>
							</tr>
						</tbody>
					</c:forEach>
					<c:if test="${userListTotalCnt eq 0}">
						<tfoot>
							<tr>
								<td colspan="6">등록된 회원이 없습니다.</td>
							</tr>
						</tfoot>
					</c:if>
				</table>
				<c:if test="${userListTotalCnt ne 0}">
					<div class="pagingWrap">
						<jsp:include page="/WEB-INF/pages/includes/paging.jsp">
							<jsp:param name="totalNum" value="${userListTotalCnt}" />
							<jsp:param name="pageListCnt" value="${maxnum}" />
							<jsp:param name="pageGrpCnt" value="10" />
							<jsp:param name="pageIdx" value="${page}" />
						</jsp:include>
					</div>
				</c:if>
				<div class="btnWrap rightBtnWrap">
					<input type="button" class="btn btn_register" alt="회원가입" title="회원가입" onclick="javascript:document.regFrm.submit();">
				</div>
			</div>
		</div>
		<form name="regFrm" method="post" action="<c:url value="/backoffice/user/form.do" />" style="display: none;">
			<input type="hidden" name="maxnum" value="${param.maxnum}" />
			<input type="hidden" name="page" value="${param.page}" />
			<input type="hidden" name="searchType" value="${param.searchType}" />
			<input type="hidden" name="searchWord" value="${param.searchWord}" />
		</form>
		<form name="detailFrm" method="post" action="<c:url value="/backoffice/user/detail.do" />" style="display: none;">
			<input type="hidden" name="idx" value="" />
			<input type="hidden" name="maxnum" value="${param.maxnum}" />
			<input type="hidden" name="page" value="${param.page}" />
			<input type="hidden" name="searchType" value="${param.searchType}" />
			<input type="hidden" name="searchWord" value="${param.searchWord}" />
		</form>
<%@ include file="/WEB-INF/pages/includes/footer.jsp" %>
	</body>
</html> 